const express = require('express');
const router = express.Router();
const customerServiceController = require('../controllers/customerServiceController');
const { optionalAuthenticateToken, authenticateUserToken } = require('../middleware/jwtAuth');

// 用户发送消息（支持游客和登录用户）
router.post('/send', optionalAuthenticateToken, customerServiceController.sendMessage.bind(customerServiceController));

// 获取用户自己的聊天记录（需要登录）
router.get('/messages', authenticateUserToken, customerServiceController.getUserMessages.bind(customerServiceController));

// 获取客服配置
router.get('/config', customerServiceController.getCustomerServiceConfig.bind(customerServiceController));

module.exports = router;

